﻿using System;

namespace XbTool.Xb2
{
    public static class Misc
    {
        public static void PrintEffectBitfield()
        {
            (int id, int bitfield, string desc)[] arr =
            {
                (0, 32776, "MaxHpUpPer"),
                (1, 32776, "StrUpPer"),
                (2, 32776, "EtherUpPer"),
                (3, 32776, "DexUpPer"),
                (4, 32776, "AgilityUpPer"),
                (5, 32776, "LuckUpPer"),
                (6, 32776, "CritRateUp"),
                (7, 32776, "PArmorUp"),
                (8, 32776, "EArmorUp"),
                (9, 32776, "BlockRateUp"),
                (10, 33800, "MaxHpUpFlat"),
                (11, 33800, "StrUpFlat"),
                (12, 33800, "EtherUpFlat"),
                (13, 33800, "DexUpFlat"),
                (14, 33800, "AgilityUpFlat"),
                (15, 33800, "LuckUpFlat"),
                (16, 33800, "CritRateUp2"),
                (17, 33800, "PArmorUp2"),
                (18, 33800, "EArmorUp2"),
                (19, 33800, "BlockRateUp2"),
                (20, 17, "DamageToEnemyTypeUp"),
                (29, 17, "InstantDeathToEnemyType"),
                (38, 8, "BladeComboDamageUp"),
                (39, 1032, "FusionComboEffectUp"),
                (40, 8, "EtherCounterDamage"),
                (41, 8, "PhysicalCounterDamage"),
                (42, 8, "AutoAttackHeal"),
                (43, 8, "ArtHeal"),
                (44, 8, "EnemyDeadHeal"),
                (45, 8, "CritDamageHeal"),
                (46, 8, "CritDamageUp"),
                (47, 8, "DoubleAttack"),
                (48, 8, "FrontDamageUp"),
                (49, 8, "SideDamageUp"),
                (50, 8, "BackDamageUp"),
                (51, 8, "SurpriseDamageUp"),
                (52, 8, "ToppleDamageUp"),
                (53, 8, "LaunchDamageUp"),
                (54, 1032, "SmashDamageUp"),
                (55, 8, "HigherLvEnemyDamageUp"),
                (56, 8, "AllyDeadDamageUp"),
                (57, 8, "GuardAnnulChance"),
                (58, 8, "AnnulReflect"),
                (59, 19, "LowHpDamageUp"),
                (69, 8, "BattleStartDamageUp"),
                (70, 8, "EnemyDeadDamageUp"),
                (71, 8, "BreakDurationUp"),
                (72, 8, "ToppleDurationUp"),
                (73, 8, "LaunchDurationUp"),
                (74, 8, "AutoAttackDamageUp"),
                (75, 8, "EnemyTargetingDamageUp"),
                (76, 8, "IndoorDamageUp"),
                (77, 8, "OutdoorDamageUp"),
                (78, 8, "BladeSwitchDamageUp"),
                (79, 8, "OppositeGenderBladeDmgUp"),
                (80, 8, "EnemyToppleResistDown"),
                (81, 8, "EnemyLaunchResistDown"),
                (82, 17, "ElementalDamageDown"),
                (91, 8, "BlockDeflectChance"),
                (92, 2049, "AbsorbElementalDamage"),
                (101, 2049, "ReflectElementalDamage"),
                (110, 19, "LowHpEvasionUp"),
                (120, 8, "MovingEvasionUp"),
                (121, 19, "LowHpBlockUp"),
                (131, 8, "CloseEnemyDamageDown"),
                (132, 19, "LowHpEnemyDamageDown"),
                (142, 20, "HighHpDamageUp"),
                (152, 8, "SpikeDamageDown"),
                (153, 8, "BreakResistanceUp"),
                (154, 8, "ToppleResistanceUp"),
                (155, 8, "LaunchResistanceUp"),
                (156, 8, "SmashResistanceUp"),
                (157, 8, "BlowdownResistanceUp"),
                (158, 8, "KnockbackResistanceUp"),
                (159, 8, "DefenseAnullResistanceUp"),
                (160, 8, ""),
                (161, 8, "AutoAttackAggroDown"),
                (162, 8, "AutoAttackAggroUp"),
                (163, 8, "ArtAggroDown"),
                (164, 8, "ArtAggroUp"),
                (165, 8, "AggroReductionUp"),
                (166, 1032, "AggroUpEverySecond"),
                (167, 1032, "BattleStartAggroUp"),
                (168, 8, "ReviveHpUpSelf"),
                (169, 8, "ReviveHpUpTeammate"),
                (170, 8, "DriverArtHeal"),
                (171, 8, "MovementHeal"),
                (172, 8, "HealingArtEffectUp"),
                (173, 8, "HpRestoreUpSelf"),
                (174, 8, "HpRestoreWhenHit"),
                (175, 8, "AutoAttackCancelHeal"),
                (176, 8, "SpecialCancelRechargeUp"),
                (177, 8, "AuttoAttackCancelDamageUp"),
                (178, 8, "Unbeatable"),
                (179, 8, "NightAccuracyUp"),
                (180, 8, "DayAccuracyUp"),
                (181, 8, "ExpUp"),
                (182, 8, "WpUp"),
                (183, 8, ""),
                (184, 8, ""),
                (185, 1032, "ExcellentSpecialPartyGaugeUp"),
                (186, 1032, "CriticalHitPartyGaugeUp"),
                (187, 1032, "DriverArtPartyGaugeUp"),
                (188, 8, "MoreEnemiesDamageUp"),
                (189, 8, "ReflectDamageUp"),
                (190, 1032, "ChainAttackStartRatioUp"),
                (191, 8, "ChainAttackCritRateUp"),
                (192, 8, "ChainAttackStartHeal"),
                (193, 2048, "ChainAttackStartRevive"),
                (194, 1032, "ChainAttackEndPgUp"),
                (195, 1032, "EtherCannonRangeUp"),
                (196, 8, "TeamHpUpOnDeath"),
                (197, 2049, "BattleStartDriverArtRecharged"),
                (213, 8, "FirstArtDamageUp"),
                (214, 8, "EnemyArtRechargeResetOnSpecial"),
                (215, 2048, "PreventDeflections"),
                (216, 8, "EnemyGoldDropRateUp"),
                (217, 8, "EnemyItemDropRateUp"),
                (218, 17, "WeaponTypeAttackUp"),
                (218, 8, "AllWeaponTypeAttackUp"),
                (268, 2048, "NoAffinityLossOnTeammateDeath"),
                (269, 8, "AffinityUpOnSpecialButtonChallenge"),
                (270, 1032, "AffinityUpOnTeammateMiss"),
                (271, 1032, "AffinityUpOnTeammateDamage"),
                (272, 8, "BladeArtTriggerProbUp"),
                (273, 8, "BladeArtDurationUp"),
                (274, 8, "PartyDamageBarrierAtAffnityMax"),
                (275, 8, "AffinityMaxDamageUp"),
                (276, 8, "AffinityMaxEvasionRate"),
                (277, 1032, "HuntersChemistry"),
                (278, 1032, "ShoulderToShoulder"),
                (279, 8, "BladeCooldownDown"),
                (280, 8, "BladeSwitchPartyHeal"),
                (281, 1032, "BladeAffinityRangeUp"),
                (281, 17, "SpecialLevelDamageUp"),
                (286, 8, "HpPotionChanceOnHit"),
                (287, 8, "HpPotionEffectUp"),
                (288, 147, "PurifyingFlames"),
                (298, 8, "AffinityMaxTeamAccuracyEvasionUp"),
                (299, 8, "ChooseElementialCombo"),
                (300, 8, "AffinityMaxPartyHpRestore"),
                (301, 8, "BladeComboDamageToTeamDown"),
                (302, 8, "DamageUpOnEvadedAttack"),
                (303, 8, "AffinityMaxArtsRechargeUp"),
                (304, 8, "AttackAggroDown"),
                (305, 8, "PhysicalEtherDefenseUp"),
                (306, 8, "EvasionAndPerfectHitProbUp"),
                (307, 8, "ReflectAttacks"),
                (308, 1032, "EvadeAllOnAffinityMax"),
                (309, 8, "ToppleLaunchDamageUp"),
                (310, 8, "IncapacitateEnemyChance"),
                (311, 8, "AffinityMaxPartyDamageDown"),
                (312, 8, "AffinityMaxDamageAoeUp"),
                (313, 8, "PartyHealOnEnemyDead"),
                (314, 8, "AffinityMaxPartyHealingUp"),
                (315, 8336, "AggroConstantIncreaseAndAttackAggroUp"),
                (316, 264, "DamageAndDefenseUpWhenAllyLowHpDead"),
                (317, 8456, "EnemyCantMoveAfterSpecial"),
                (318, 1032, "HigherSpecialDamageForLowerHp"),
                (319, 8, "EnemyDriverComboResistance"),
                (320, 8, "FusionComboStartPartyHeal"),
                (321, 1288, "AttackUpOnGoldCollect"),
                (322, 8, "DropGoldOnAttack"),
                (323, 8, "AffinityMaxEnemyRechargeDown"),
                (324, 8, "DamageUpAgainstBossOrUm"),
                (325, 8, "NoUseRechargeOnArtOrSpecial"),
                (326, 8, "AnnulDefenseAndSpecialDamageUp"),
                (327, 8456, "AffinityMaxAttackUpDefenseDown"),
                (328, 8, "AnnulDefenseChance"),
                (329, 8, "Transmigration"),
                (330, 8, "DamageUpOnElementalWeakness"),
                (331, 264, "ChanceBlowdownEnemyWhenAttacked"),
                (332, 8, "AutoAttackSpeedUp"),
                (333, 8, "DoubleAttackAndDamageUp"),
                (334, 264, "ToppleDamageUpExtendToppleDuration"),
                (335, 8, "DrainHpAndEvasionDuringArt"),
                (336, 8, "ReduceAggroOnHit"),
                (337, 8, "RechargeArtOnCrit"),
                (338, 1032, "AffinityUpOnSpecial"),
                (339, 8, "BreakResistDown"),
                (340, 8, "LowHpHeal"),
                (341, 8, "DamageIncreaseAfterSpecial"),
                (342, 264, "KnockbackChanceWhenAttacked"),
                (343, 8, "AffinityMaxAccuracyUp"),
                (344, 1032, "HpPotionDurationUp"),
                (345, 8, "DamageUpForEachFemale"),
                (346, 264, "AffinityMaxDamageUpDefenseUp"),
                (347, 8, "ChainAttackCritRateUpWhenSelected"),
                (348, 1032, "DamageAllOnBladeSwitch"),
                (349, 2048, "DriverArtCancel"),
                (350, 8, "CancelWindowUp"),
                (351, 8, "PartyHealOnHit"),
                (352, 8, "ComboBufferUpOnSwitch"),
                (353, 8, "AffinityMaxPartyDamageUp"),
                (354, 264, "AegisDriverAbilitiesUp"),
                (355, 2056, "AegisPartyAbilitiesUp"),
                (356, 8, "HealAndRechargeArtsOnGuard"),
                (357, 8, "RangedAttackEvasionUp"),
                (358, 8, ""),
                (359, 8, "OverclockingBangle"),
                (360, 8, ""),
                (361, 8, ""),
                (362, 8, ""),
                (363, 8, ""),
                (364, 8, ""),
                (365, 8, ""),
                (366, 1032, ""),
                (367, 2048, ""),
                (368, 8, ""),
                (369, 1168, ""),
                (370, 8, "CombatMoveSpeedUp"),
                (371, 8, ""),
                (372, 1032, ""),
                (373, 8, ""),
                (374, 1032, ""),
                (375, 2048, ""),
                (376, 8, "TauntResistanceUp"),
                (377, 8, "DriverShackleResistanceUp"),
                (378, 8, "BladeShackleResistanceUp"),
                (379, 8, ""),
                (380, 8, ""),
                (381, 2048, ""),
                (382, 8, ""),
                (383, 8, ""),
                (384, 8, ""),
                (385, 2048, "ElementalBurstDestroyRandomOrb"),
                (386, 8, "HpPotSpawnWithSecondChance"),
                (387, 2048, "OpposingElementDestroysOrb"),
                (388, 8, "CauseNearbyOrbDamage"),
                (389, 2048, "TargetDamagedOrbs"),
                (390, 8, "StenchResistanceUp"),
                (391, 8, ""),
                (392, 2048, ""),
                (393, 8, "OrbMaster"),
                (394, 8, "RetainAggroOnDeath"),
                (395, 2048, "EyeShiningJustice"),
                (396, 1032, ""),
                (397, 8, "DamageUpEverySelfDeath"),
                (398, 8, ""),
                (399, 264, "AutoAttackArtsSpeedUp"),
                (400, 8, "Lv4SpecialDamageUpOnUse"),
                (401, 17416, "HasVisions"),
                (402, 8, "PurgeAwakening"),
                (403, 8, "AffinityMaxPartyCritRateUp"),
                (404, 8, "DamageUpOnEachCriticalHit"),
                (405, 8, "EtherSpikeOnEvade"),
                (406, 8, "HealSelfOnEvade"),
                (407, 1032, "ArtsRechargeOnEvade"),
                (408, 8, "LaunchPartyDamageUp"),
                (409, 8, "DamageUpOnEachHealPot"),
                (410, 8, "ItemCollectionRangeUp"),
                (411, 8, "NullifyHealResistanceUp"),
                (412, 8, "DoomResistanceUp"),
                (413, 8, "PartyGaugeDrainAttacksUp"),
                (414, 264, "DealAndTakeMoreDamage"),
                (415, 264, "DealAndTakeLessDamage"),
                (416, 8, ""),
                (417, 8, ""),
                (418, 8, ""),
                (419, 1032, ""),
                (420, 8, ""),
                (421, 8, ""),
                (422, 8, "")
            };

            for (int i = 0; i < arr.Length; i++)
            {
                int x = arr[i].bitfield;
                int paramType = x & 7;
                int paramA = (x >> 3) & 0xF;
                int paramB = (x >> 7) & 0xF;
                int bfD = (x >> 11) & 0x7;
                int bfE = (x >> 14) & 0x1;

                Console.WriteLine($"{i + 1}\t{arr[i].id}\t{paramType}\t{paramA}\t{paramB}\t{bfD}\t{bfE}");
            }
        }
    }
}
